Load icon from executable on Windows
authordparisot <dparisot@mgen.fr>
Sun, 21 Mar 2021 14:24:28 +0000 (15:24 +0100)
committerdparisot <dparisot@mgen.fr>
Sun, 21 Mar 2021 14:24:28 +0000 (15:24 +0100)
gdk/win32/gdksurface-win32.c

index 03250491d42c713a800d07085633bea317f4566b..1d0f12771a5b9245e1b0c7c198ef20981d23d3f2 100644 (file)
@@ -352,12 +352,14 @@ RegisterGdkClass (GdkSurfaceType wtype)
     {
       char sLoc [MAX_PATH+1];
 
-      if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
+      // try to load first icon of executable program
+      if (0 != GetModuleFileName (NULL, sLoc, MAX_PATH))
         {
           ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);
 
           if (0 == hAppIcon && 0 == hAppIconSm)
             {
+              // fallback : load icon from GTK DLL
               if (0 != GetModuleFileName (_gdk_dll_hinstance, sLoc, MAX_PATH))
                {
                  ExtractIconEx (sLoc, 0, &hAppIcon, &hAppIconSm, 1);